#pragma once

#include <QLabel>
#include <QMainWindow>
#include <QMouseEvent>
#include "Game.h"
#include "GameBoard.h"
#include "RivalWindow.h"

namespace Ui {
    class MainWindow;
}

// 主窗口
class MainWindow: public QMainWindow {
    Q_OBJECT

    private: Ui::MainWindow* ui;        // 界面
    private: GameBoard mGameBoard;      // 游戏区域
    private: Game* mGame;               // 游戏
    private: QLabel mLabelRivalName;    // "当前对手"标签
    private: RivalWindow mRivalWindow;  // 对手列表窗口

    public: explicit MainWindow(QWidget* parent = nullptr);
    public: ~MainWindow();
    private: void logon();
    private: void mouseReleaseEvent(QMouseEvent*);
    private slots: void on_actionDefeat_triggered();
    private slots: void on_actionFindUsers_triggered();
    private slots: void on_actionRestart_triggered();
    private slots: void onGameOver(GameOverReason);
    private slots: void onGameStart(const char*);
    private slots: void onGetFindUsersResult(FindUsersResult*);
    private slots: void onGetInviteRequest(const char*);
    private slots: void onGetInviteResult(const char*, bool);
    private slots: void onGetLogonResult(bool);
    private slots: void onGetRivalName(const char*);
    private slots: void onRivalQuitGame(bool, const char*);
};
